package com.ucode.hrm.service;

import cn.hutool.core.util.ObjectUtil;
import com.ucode.hrm.mapper.HrmPersonalResumeMapper;
import com.ucode.model.hrm.HrmPersonalResume;
import com.ucode.model.hrm.enums.HrmSysResultCodeEnum;
import com.ucode.springboot.starter.mybatis.core.base.BaseService;
import com.ucode.tool.base.enums.GlobalResultCodeEnum;
import com.ucode.tool.exception.UcodeServiceException;

/**
 * 个人简历 Service 接口
 * @Author: liliang
 * @Date: 2025/6/1 14:39
 * @Version: 1.0
 */
public interface HrmPersonalResumeService extends BaseService<Long, HrmPersonalResume, HrmPersonalResumeMapper> {

    /**
     * 获取会员个人简历信息
     * @param memberId
     * @return
     */
    public HrmPersonalResume selectOneByMemberId(Long memberId);
    /**
     * 验证是否合法并返回
     * @param id
     * @return
     */
    default HrmPersonalResume validate(Long id){
        if(ObjectUtil.isNull(id) )
            throw new UcodeServiceException(GlobalResultCodeEnum.VALIDATE_FAILED);
        //验证数据是否存在
        HrmPersonalResume bean = this.selectByPrimaryKey(id);
        if(ObjectUtil.isNull(bean) || bean.getDeltag()){
            throw new UcodeServiceException(HrmSysResultCodeEnum.EMPLOYEE_NOT_EXISTS);
        }
        return bean;
    }

}
